﻿using System;
using System.ComponentModel;
using PocketBlueBird.Configuration;

namespace PocketBlueBird.ViewModels
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        public delegate void GettingDataHandler(bool isGettingData);

        public GettingDataHandler IsGettingData;

        public event PropertyChangedEventHandler PropertyChanged;

        public readonly string _consumerKey;

        public readonly string _consumerSecret;

        public static bool IsAuthorized
        {
            get
            {
                return App.AccessToken != null;
            }
        }

        public BaseViewModel()
        {
            _consumerKey = MyApplicationSetting.MyAppSetting["ConsumerKey"].ToString();
            _consumerSecret = MyApplicationSetting.MyAppSetting["ConsumerSecret"].ToString();
        }

        public void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }


    }
}
